// --------------------------------------------------------------------------------------------------------------------
// <copyright file="InstrumentStaticDataForexFuture.cs" company="Open Trader">
//   Copyright (c) David Denis (david.denis@systemathics.com)
// </copyright>
// <summary>
//   |  Open Trader - The Open Source Systematic Trading Platform
//   |
//   |  This program is free software: you can redistribute it and/or modify
//   |  it under the terms of the GNU General Public License as published by
//   |  the Free Software Foundation, either version 2 of the License, or
//   |  (at your option) any later version.
//   |
//   |  This program is distributed in the hope that it will be useful,
//   |  but WITHOUT ANY WARRANTY; without even the implied warranty of
//   |  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//   |  GNU General Public License for more details.
//   |
//   |  You should have received a copy of the GNU General Public License
//   |  along with this program.  If not, see http://www.gnu.org/licenses
//   |
//   |  Up to date informations about Open Trader can be found at :
//   |    http://opentrader.org
//   |    http://opentrader.codeplex.com
//   |
//   |  For professional services, please visit us at :
//   |    http://www.systemathics.com
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Org.OpenTrader.Framework.Forge
{
    #region Using Directives

    using System;
    using System.ComponentModel;

    using DataModel;

    using Org.OpenTrader.Framework.DataModel;
    using Org.OpenTrader.Framework.Forge.Attributes;
    using Org.OpenTrader.Framework.Forge.Enums;
    using Org.OpenTrader.Framework.Forge.Interfaces;

    #endregion

    /// <summary>
    /// The instrument forex future.
    /// </summary>
    [Serializable]
    [InstrumentFriendlyDisplay("Forex Future", "Future instrument written on Forex")]
    public sealed class InstrumentStaticDataForexFuture : InstrumentStaticData, IInstrumentStaticDataForexFuture
    {
        #region Constructors and Destructors

        /// <summary>
        /// Initializes a new instance of the <see cref="InstrumentStaticDataForexFuture"/> class. 
        /// </summary>
        /// <param name="dictionaryID">
        /// The dictionary ID.
        /// </param>
        /// <param name="dbInstrumentForexFuture">
        /// The dbInstrumentForexFuture.
        /// </param>
        /// <param name="dbInstrument">
        /// The dbInstrument.
        /// </param>
        public InstrumentStaticDataForexFuture(Guid dictionaryID, DBInstrumentStaticDataForexFuture dbInstrumentForexFuture, DBInstrumentStaticData dbInstrument)
            : base(dictionaryID, dbInstrument)
        {
            this.Currency2 = EnumDecoder<ECurrency>.Parse(dbInstrumentForexFuture.Currency2);
            if (dbInstrumentForexFuture.Maturity.HasValue)
            {
                this.Maturity = dbInstrumentForexFuture.Maturity.Value;
            }
        }

        #endregion

        #region Properties

        /// <summary>
        /// Gets or sets Currency2.
        /// </summary>
        [Category("Forex Future")]
        [Description("Currency2 of Currency1/Currency2")]
        public ECurrency Currency2 { get; set; }

        /// <summary>
        /// Gets or sets Maturity.
        /// </summary>
        [Category("Forex Future")]
        [Description("Maturity date")]
        public DateTime Maturity { get; set; }

        /// <summary>
        /// Gets Type.
        /// </summary>
        public override string Type
        {
            get
            {
                return "ForexFuture";
            }
        }

        #endregion

        #region Public Methods

        /// <summary>
        /// The string representation.
        /// </summary>
        /// <returns>
        /// Returns "Forex Future"
        /// </returns>
        public override string ToString()
        {
            return base.ToString() + " (Forex Future)";
        }

        #endregion
    }
}